잠시만 기다려 주세요

     '이태원 핼러윈 참사.. 150명 넘게 죽었는데 눈치나 보며 아무것도 안 하는 민주당을 규탄한다. 총선 보이콧... 문재인 시즌2 는 절대 금지다...'
전체검색 :  
이번주 로또 및 연금번호 발생!!   |  HOME   |  여기는?   |  바다물때표   |  알림 (16)  |  여러가지 팁 (1054)  |  추천 및 재미 (150)  |  자료실 (22)  |  
시사, 이슈, 칼럼, 평론, 비평 (584)  |  끄적거림 (127)  |  문예 창작 (703)  |  바람 따라 (69)  |  시나리오 (760)  |  드라마 대본 (248)  |  
살인!


    postgresql

postgresql - postgresql 튜플 tuple 상태보기. 최적화 베큠 vacuumdb 실행하기.. 테이블 용량 최적화, 줄이기.
이 름 : 바다아이   |   조회수 : 9048         짧은 주소 : https://www.bada-ie.com/su/?601591783482
SELECT c.relname, pg_stat_get_live_tuples(c.oid) + pg_stat_get_dead_tuples(c.oid) as t_tup,
pg_stat_get_live_tuples(c.oid) AS n_live_tup,
pg_stat_get_dead_tuples(c.oid) AS n_dead_tup,
round(100*pg_stat_get_live_tuples(c.oid) / (pg_stat_get_live_tuples(c.oid) + pg_stat_get_dead_tuples(c.oid)),2) as live_tuple_rate,
round(100*pg_stat_get_dead_tuples(c.oid) / (pg_stat_get_live_tuples(c.oid) + pg_stat_get_dead_tuples(c.oid)),2) as dead_tuple_rate,
pg_size_pretty(pg_total_relation_size(c.oid)) as total_rel_size,
pg_size_pretty(pg_relation_size(c.oid)) as rel_size
FROM pg_class as c
WHERE pg_stat_get_live_tuples(c.oid) > 0
AND c.relname NOT LIKE 'pg_%' ORDER BY n_live_tup DESC;


봐서 vacuumdb 돌려야 겠다 싶으면 바로 돌리세요.... 그래야 찌꺼기 날리죠....
postgresql 이 이게 좀 귀찮은 일인데... 아무튼... 그래도 정기적인 vacuumdb 는 해 주어야 합니다.
안 그러면 무한대로 테이블이 커져요....
delete 나 update 했다고 실제 데이터가 삭제되는 게 아닙니다. 반드시 vacuumdb 실행 할 것....
용량이 크거나 사용자 접속이 많은 곳은 새벽에 돌리세요..... 시간 오래 걸립니다.

vacuumdb -U 사용자 -d 디비명 -f

아니면 터미널에서 해당 디비로 접속, 가급적 유저는 postgres 로 접속하세요. 명령어는 아래와 같습니다.....
유저를 postgresql 로 접속 안 하시면 vacuum 시 통계 및 기타 테이블들 권한 없다고 나옵니다.

psql -U postgres -d 디비명

아래 참고 하시고 맞는 거 하세요...
그냥 vacuum 치면 해당 디비 테이블 전부다 합니다.


    Plain VACUUM: Frees up space for re-use

    VACUUM [tablename]

    Full VACUUM: Locks the database table, and reclaims more space than a plain VACUUM

    /* Before Postgres 9.0: */
    VACUUM FULL
    /* Postgres 9.0+: */
    VACUUM(FULL) [tablename]

    Full VACUUM and ANALYZE: Performs a Full VACUUM and gathers new statistics on query executions paths using ANALYZE

    /* Before Postgres 9.0: */
    VACUUM FULL ANALYZE [tablename]
    /* Postgres 9.0+: */
    VACUUM(FULL, ANALYZE) [tablename]

    Verbose Full VACUUM and ANALYZE: Same as #3, but with verbose progress output

    /* Before Postgres 9.0: */
    VACUUM FULL VERBOSE ANALYZE [tablename]
    /* Postgres 9.0+: */
    VACUUM(FULL, ANALYZE, VERBOSE) [tablename]

 
| |





      1 page / 2 page
번 호 카테고리 제 목 이름 조회수
45 postgresql postgresql ... postgresql 14 .. postgresql.conf port 5432 .. 바다아이 687
44 postgresql , count(*) .... 바다아이 6870
43 postgresql How to do an update + join in PostgreSQL?, 바다아이 6102
42 postgresql sequence(퀀) 바다아이 7737
41 postgresql , , , index create, , 바다아이 8113
40 postgresql postgresql log_timezone .... 바다아이 6511
39 postgresql postgresql SEQUENCE reset .... 바다아이 8352
38 postgresql [PostgreSql] WITH , , Operator 바다아이 7744
37 postgresql postgresql for, foreach , 바다아이 9301
36 postgresql postgresql , , into ... 바다아이 9294
35 postgresql postgresql PL/pgSQL - SQL Procedural Language, , 바다아이 10712
34 postgresql postgresql ... .. , , 바다아이 11734
33 postgresql postgresql CSV export/import 바다아이 8532
32 postgresql postgresql tablespace , .... 바다아이 12861
31 postgresql postgresql 10 partitioning, ... , ... 바다아이 9277
30 postgresql Using PostgreSQL Arrays, ... ... 바다아이 9233
29 postgresql PostgreSQL (TRIGGER) (function) 바다아이 8998
28 postgresql Optimize and Improve PostgreSQL Performance with VACUUM, ANALYZE, and REINDEX 바다아이 9648
현재글 postgresql postgresql tuple . vacuumdb .. , . 바다아이 9049
26 postgresql postgresql , .. 바다아이 9244
25 postgresql postgresql , size, 바다아이 11246
24 postgresql postgresql , , .... 바다아이 8284
23 postgresql PostgreSQL Replication, , , master, slave 바다아이 10780
22 postgresql postgresql case 바다아이 8155
21 postgresql postgresql with 바다아이 8590
20 postgresql postgresql , , string 바다아이 11500
19 postgresql Postgresql partitioning table , , , 바다아이 9091
18 postgresql PostgreSQL 바다아이 10576
17 postgresql postgresql vacuumdb, psql, pg_dump password crontab , pgpass 바다아이 10264
16 postgresql postgresql sequence 퀀 auto_increment . 바다아이 9690
| |









Copyright ⓒ 2001.12. bada-ie.com. All rights reserved.
이 사이트는 리눅스에서 firefox 기준으로 작성되었습니다. 기타 브라우저에서는 다르게 보일 수 있습니다.
[ Ubuntu + GoLang + PostgreSQL + Mariadb ]
서버위치 : 오라클 클라우드 춘천  실행시간 : 0.13357
to webmaster... gogo sea. gogo sea.